package com.ronri.list.editview.controls;///**
// * 文件：EditWheelView.java
// * 包名：com.ronri.list.editview.controls;   --- 正式发布时需要修正
// * 说明：区域滚动选择器
// * 作者：MS During
// * 日期：2017/5/2
// * 历史：
// */
//package com.ronri.list.editview.controls;
//
//
//import android.content.Context;
//import android.util.Log;
//import android.view.Gravity;
//import android.view.View;
//import android.view.WindowManager;
//import android.widget.EditText;
//import android.widget.ImageView;
//import android.widget.PopupWindow;
//import android.widget.TextView;
//
//import com.ronri.common.SystemManager;
//import com.ronri.ams.R;
//import com.ronri.ams.SystemApplication;
////import com.ronri.whellview.ItemData;
////import com.ronri.whellview.RegionItem;
////import com.ronri.whellview.WheelView;
//
//import java.util.ArrayList;
//import java.util.List;
//
//public class EditWheelView extends BaseControl {
//
//    // 调试标志
//    private String TAG = "EditWheelView";
//
//    // 弹框
//    PopupWindow popupWindow = null;
//
//    // 样例数据
//    //private static final String[] PLANETS = new String[]{"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Uranus", "Neptune", "Pluto"};
//
//    private List<ItemData> areaPLANETS = new ArrayList<ItemData>();
//    private List<ItemData> countyPLANETS = new ArrayList<ItemData>();
//    private List<ItemData> townPLANETS = new ArrayList<ItemData>();
//
//    /***
//     * 构造函数
//     */
//    public EditWheelView(){
//        super();
//
//        this.ControlName = "EditWheelView";
//        this.BindLayout(R.layout.control_region_wheelview);
//
//        areaPLANETS.add(new RegionItem("请选择", "-1", "-1"){});
//        areaPLANETS.add(new RegionItem("南京", "3201", "32"){});
//        areaPLANETS.add(new RegionItem("常州", "3204", "32"){});
//        areaPLANETS.add(new RegionItem("无锡", "3202", "32"){});
//        areaPLANETS.add(new RegionItem("苏州", "3203", "32"){});
//        areaPLANETS.add(new RegionItem("镇江", "3205", "32"){});
//        areaPLANETS.add(new RegionItem("南通", "3206", "32"){});
//        areaPLANETS.add(new RegionItem("宿迁", "3207", "32"){});
//        areaPLANETS.add(new RegionItem("淮阴", "3208", "32"){});
//
//        countyPLANETS.add(new RegionItem("请选择", "-1", "-1"){});
//        countyPLANETS.add(new RegionItem("南京", "3201", "32"){});
//        countyPLANETS.add(new RegionItem("常州", "3204", "32"){});
//        countyPLANETS.add(new RegionItem("镇江", "3205", "32"){});
//        countyPLANETS.add(new RegionItem("宿迁", "3207", "32"){});
//
//        townPLANETS.add(new RegionItem("请选择", "-1", "-1"){});
//        townPLANETS.add(new RegionItem("南京", "3201", "32"){});
//        townPLANETS.add(new RegionItem("常州", "3204", "32"){});
//        townPLANETS.add(new RegionItem("苏州", "3203", "32"){});
//        townPLANETS.add(new RegionItem("镇江", "3205", "32"){});
//        townPLANETS.add(new RegionItem("南通", "3206", "32"){});
//        townPLANETS.add(new RegionItem("宿迁", "3207", "32"){});
//        townPLANETS.add(new RegionItem("淮阴", "3208", "32"){});
//    }
//
//    /***
//     * 显示编辑控件
//     * @return
//     */
//    @Override
//    public boolean ShowEditControl(View Anchor) {
//        WindowManager manager = (WindowManager) SystemApplication.getInstance().getSystemService(Context.WINDOW_SERVICE);
//        @SuppressWarnings("deprecation")
//        int nWidth = manager.getDefaultDisplay().getWidth();
//        int nHeight = manager.getDefaultDisplay().getHeight();
//
//        View view = getView();
//
//        ImageView imgViewCancel = (ImageView) view.findViewById(R.id.edit_fail);
//        TextView imgViewOK = (TextView)view.findViewById(R.id.edit_success);
//        WheelView areaView = (WheelView)view.findViewById(R.id.region_area);
//        WheelView countyView = (WheelView)view.findViewById(R.id.region_county);
//        WheelView townView = (WheelView)view.findViewById(R.id.region_town);
//
//        areaView.setOffset(0);
//        areaView.setItems(areaPLANETS);
//        areaView.setOnWheelViewListener(new WheelView.OnWheelViewListener(){
//            @Override
//            public void onSelected(int selectedIndex, ItemData item) {
//                Log.d(TAG, "selectedIndex: " + selectedIndex + ", item: " + item.toString());
//            }
//        });
//
//        countyView.setOffset(0);
//        countyView.setItems(countyPLANETS);
//        countyView.setOnWheelViewListener(new WheelView.OnWheelViewListener(){
//            @Override
//            public void onSelected(int selectedIndex, ItemData item) {
//                Log.d(TAG, "selectedIndex: " + selectedIndex + ", item: " + item.toString());
//            }
//        });
//
//        townView.setOffset(0);
//        townView.setItems(townPLANETS);
//        townView.setOnWheelViewListener(new WheelView.OnWheelViewListener(){
//            @Override
//            public void onSelected(int selectedIndex, ItemData item) {
//                Log.d(TAG, "selectedIndex: " + selectedIndex + ", item: " + item.toString());
//            }
//        });
//
//        /***
//         * 放弃选择
//         */
//        imgViewCancel.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                popupWindow.dismiss();
//            }
//        });
//
//
//        /***
//         * 确认返回结果集
//         */
//        imgViewOK.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//
//                if(BaseControlEevnt != null){
//
//                    // 校验数据
//                    boolean bRet = Validate();
//
//                    // 回调，传递结果
//                    BaseControlEevnt.ReturnValue(this);
//                }
//
//                popupWindow.dismiss();
//            }
//        });
//
//
//        popupWindow = new PopupWindow(view,
//                WindowManager.LayoutParams.MATCH_PARENT,
//                nHeight - SystemManager.getStatusBarHeight(), true);
//
//
//        // 设置弹出窗体显示时的动画，从底部向上弹出
//        popupWindow.setAnimationStyle(R.style.take_photo_anim);
//        popupWindow.showAtLocation(Anchor, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
//
//        return true;
////        final WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
////        WindowManager.LayoutParams para = new WindowManager.LayoutParams();
////        para.height = 500;
////        para.width = 600;
////        para.format = 1;
////
////        para.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
////
////        para.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
////        final View mView = getView();
////
////        wm.addView(mView, para);
////
////        return true;
//    }
//
//    /***
//     * 隐藏控件
//     * @return
//     */
//    @Override
//    public boolean HideEditControl() {
//        return false;
//    }
//
//    /***
//     * 校验数据
//     * @return
//     */
//    @Override
//    public boolean Validate() {
//
//        EditText ctl = (EditText)this.getView();
//
//        String szValue = ctl.getText().toString();
//
//        if (szValue.length() == 13)
//            return true;
//
//        return false;
//    }
//
//    /***
//     * 获取错误信息
//     * @return
//     */
//    @Override
//    public String GetErrorMessage() {
//        return getContext().getString(R.string.validate_card_error);
//    }
//
//}
